from tkinter import *
from tkinter import messagebox  # 单独导入

window = Tk()
window.title("这是第二个窗口界面")
window.geometry("700x500")
window.withdraw() # 隐藏根窗口

# messagebox.showinfo("表白","我喜欢你")  # 标题 内容
# messagebox.showerror("表白","我喜欢你")
# txt = messagebox.askyesno("表白","做我女朋友可以吗？")
# print(txt)
# txt = messagebox.askyesnocancel("表白","做我女朋友可以吗？")
# print(txt)

# 表白窗口
messagebox.showinfo("表白","我喜欢你")
messagebox.showinfo("表白","我喜欢你很久了")
while True:
    answer1 = messagebox.askyesnocancel("表白","做我女朋友好吗？")
    if answer1:
        break
    else:
        messagebox.showerror("表白","再想想好吗？")
while True:
    answer2 = messagebox.askyesno("表白","今年七夕一起过")
    if answer2:
        break
    else:
        messagebox.showerror("表白", "再想想好吗？")
messagebox.showinfo("表白","太好了\n你是我女朋友了！")

window.mainloop()